package com.yanqu.road.server.cmd.activity.feast;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.ShanHeFeastProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.activity.feast.CrossFeastMgr;
import com.yanqu.road.server.manager.activity.feast.activity.CrossFeastActivity;
import com.yanqu.road.server.protocol.CrossProtocol;

@Cmd(code = CrossProtocol.C_CROSS_SHAN_HE_FEAST_PVE_PROPERTY_CHANGE, desc = "上传用户数据")
public class CrossFeastPvePropertyChangeCmd extends CrossCommand {

    private int activityId;

    private ShanHeFeastProto.CrossFeastPvePropertyChangeReqMsg reqMsg;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        reqMsg = ShanHeFeastProto.CrossFeastPvePropertyChangeReqMsg.parseFrom(packet.getBytes());
        activityId = reqMsg.getActivityId();
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        CrossFeastActivity activity = CrossFeastMgr.getActivity(activityId);
        if (activity != null) {
            activity.pvePropertyChange(reqMsg);
        }
    }

    @Override
    public void sendData() {

    }
}
